<!--流程业务化-可疑品业务，包含所有环节发现的物料的可疑品问题进行登记-->

<!--用户权限说明-->
<!--管理员：代码：1，可以做所有的操作-->
<!---->
<template>
  <div style="margin: 0;padding: 0">
    <el-container>
      <!--页面表头设计-->
      <el-header style="height: 7vh">
        <el-link class="headMain" href="http://10.255.96.48:3404/">俄动力质量管理系统</el-link>
        <span class="center-text">可疑品业务</span>
        <el-popover
            placement="top-start"
            title="用户信息"
            width="200"
            trigger="hover">
          <div style="margin-top: 10px">Name：{{useName}}</div>
          <div style="margin-top: 10px">ID:{{useId}}</div>
          <div style="margin-top: 10px" @click="logOut"><el-link>退出</el-link></div>
          <div class="headMain" slot="reference">{{useName}}</div>
        </el-popover>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <div style="margin-top:10px;">
            <el-button style="width: 100%"
                       :style="{backgroundColor:buttonBackColor1,color:buttonColor1}"
                       @click="buttonMainSelect(1)">所有环节</el-button>
          </div>
          <div style="margin-top:10px;" >
            <el-button style="width: 100%"
                       :style="{backgroundColor:buttonBackColor2,color:buttonColor2}"
                       @click="buttonMainSelect(2)">装配车间</el-button>
          </div>
          <div style="margin-top:10px;">
            <el-button style="width: 100%"
                       :style="{backgroundColor:buttonBackColor3,color:buttonColor3}"
                       @click="buttonMainSelect(3)">机加车间</el-button>
          </div>
          <div style="margin-top:10px;">
            <el-button style="width: 100%"
                       :style="{backgroundColor:buttonBackColor4,color:buttonColor4}"
                       @click="buttonMainSelect(4)">其他环节</el-button>
          </div>
        </el-aside>
        <el-container>
          <!--主题设计-->
          <el-main style="height: 79vh;overflow: auto">
            <el-tabs v-model="activeName" @tab-click="handleClick">
              <el-tab-pane label="报警/故障清单" name="exception">
                <div style="margin-bottom: 5px">
                  <el-button size="mini" @click="editException(1,null)">添加</el-button>
                </div >
                <el-table
                    :data="exceptionData"
                    border
                    style="width: 100%;"
                    height="450">
                  <el-table-column
                      prop="workShop"
                      label="车间名称"
                      v-slot:default="scope">
                    <span v-if="languageS==='chinese'">{{scope.row.workShop.split('/')[0]}}</span>
                    <span v-if="languageS==='english'">{{scope.row.workShop.split('/')[1]}}</span>
                    <span v-if="languageS==='other'">{{scope.row.workShop.split('/')[2]}}</span>
                  </el-table-column>
                  <el-table-column
                      prop="op"
                      label="工序号">
                  </el-table-column>
                  <el-table-column
                      prop="establishTime"
                      label="创建时间">
                  </el-table-column>
                  <el-table-column
                      prop="updateTime"
                      label="修改时间">
                  </el-table-column>
                  <el-table-column
                      prop="editName"
                      label="编辑人">
                  </el-table-column>
                  <el-table-column
                      prop="excMessage"
                      label="报警信息">
                  </el-table-column>
                  <el-table-column
                      prop="excDate"
                      label="报警时间">
                  </el-table-column>
                  <el-table-column
                      prop="excPersonName"
                      label="报警反馈人">
                  </el-table-column>
                  <el-table-column
                      prop="excType"
                      label="报警类别">
                  </el-table-column>
                  <el-table-column
                      prop="downTimeOp"
                      label="停机时间">
                  </el-table-column>
                  <el-table-column
                      prop="downTimeLine"
                      label="停线时间">
                  </el-table-column>
                  <el-table-column
                      prop="excType"
                      label="报警类别">
                  </el-table-column>
                  <el-table-column
                      prop="isProblem"
                      label="问题进展"
                      v-slot:default="scope">
                    <template>
                      <template>
                        <el-popover
                            v-model="scope.row.isProblemVisible"
                            placement="top"
                            width="140"
                            trigger="manual">
                          <div style="margin-bottom: 10px">
                            <el-button @click="isProblemContact(1,scope)" style="width: 150px">新增问题</el-button>
                          </div>
                          <div style="margin-bottom: 10px">
                            <el-button @click="isProblemContact(3,scope)" style="width: 150px">关联已有问题</el-button>
                          </div>
                          <div style="margin-bottom: 10px">
                            <el-button @click="isProblemContact(2,scope)" style="width: 150px">不需解决，挂起</el-button>
                          </div>
                          <template #reference>
                            <el-link @click.stop="togglePopover(scope)" v-if="scope.row.isProblem===-1">未关联</el-link>
                          </template>
                        </el-popover>
                      </template>
                    </template>
                    <el-link v-if="scope.row.isProblem===0" @click="excProblemShow(scope)">未结题</el-link>
                    <el-link v-if="scope.row.isProblem===1" @click="excProblemShow(scope)">已结题</el-link>
                    <el-link v-if="scope.row.isProblem===2">挂起</el-link>
                  </el-table-column>
                  <el-table-column
                      prop=""
                      label="编辑">
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane label="问题解决" name="ProblemSolving">
                <div>
                  <el-table
                      :data="problemData"
                      border
                      style="width: 100%">
                    <el-table-column
                        prop="problemName"
                        label="问题名称"
                        width="350">
                    </el-table-column>
                    <el-table-column
                        prop="describeUse"
                        label="问题描述"
                        width="550"
                        v-slot:default="scope">
                      <span v-html="scope.row.describeUse"></span>
                    </el-table-column>
                    <el-table-column
                        prop="finish"
                        label="问题状态">
                    </el-table-column>
                    <el-table-column
                        prop="liability"
                        label="负责人">
                    </el-table-column>
                    <el-table-column
                        prop=""
                        label="编辑"
                        v-slot:default="scope">
                      <el-link @click="problemShow(scope)">查看</el-link>
                      <el-link @click="problemEditShow(scope,23)" style="margin-left: 8px">修改</el-link>
                    </el-table-column>
                  </el-table>
                </div>
                <div>
                </div>
              </el-tab-pane>
              <el-tab-pane label="五件确认"></el-tab-pane>
              <el-tab-pane label="模型说明" name="third">模型说明</el-tab-pane>
            </el-tabs>
          </el-main>
          <el-footer>
            <el-button plain size="small" @click="chooseLanguage('chinese')">中  文</el-button>
            <el-button plain size="small" @click="chooseLanguage('russian')">Русский язык</el-button>
            <el-button plain size="small" @click="chooseLanguage('english')">English</el-button>
          </el-footer>
        </el-container>
      </el-container>
    </el-container>

    <!--弹窗放置区-->
    <!--新增一个报警、异常解除信息的弹窗-->
    <el-dialog
        :title="titleUse"
        :visible.sync="exceptionDialog"
        width="650px"
        :before-close="handleClose">
      <el-form ref="suspectListForm" :inline="true" :model="exceptionForm" label-width="100px">
        <div>
          <el-form-item label="车间名称：">
            <el-select v-model="exceptionForm.workShop" filterable clearable placeholder="请选择类别" style="margin-left: 10px;width: 450px">
              <el-option
                  v-for="item in optionWorkshopNew"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="线体名称：">
            <el-select v-model="exceptionForm.lineName" filterable clearable placeholder="请选择类别" style="margin-left: 10px;width: 450px">
              <el-option
                  v-for="item in lineName"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="工序号：">
            <el-select v-model="exceptionForm.op" filterable clearable placeholder="请选择类别" style="width: 175px">
              <el-option
                  v-for="item in op"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="反馈人：">
            <el-input v-model="exceptionForm.excPersonName" style="width: 175px"></el-input>
          </el-form-item>
          <el-form-item label="发生时间:" label-width="100px">
            <el-date-picker
                v-model="exceptionForm.excDate"
                type="date"
                placeholder="选择日期"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                style="width: 175px"
                >
            </el-date-picker>
          </el-form-item>
          <el-form-item label="报警时间：">
            <el-time-picker
                v-model="occurTime"
                placeholder="任意时间点"
                format="HH:mm:ss"
                value-format="HH:mm:ss"
                style="width: 175px">
            </el-time-picker>
          </el-form-item>
          <el-form-item label="停机时间:" label-width="100px">
            <el-input-number v-model="exceptionForm.downTimeOp" style="width: 175px"></el-input-number>
          </el-form-item>
          <el-form-item label="停线时间：">
            <el-input-number v-model="exceptionForm.downTimeLine" style="width: 175px"></el-input-number>
          </el-form-item>
          <el-form-item label="报警信息:">
            <el-input v-model="exceptionForm.excMessage"
                      type="textarea"
                      :rows="2"
                      placeholder="请输入内容"
                      style="width: 450px"></el-input>
          </el-form-item>
        </div>
        <el-button @click="exceptionDialog=false">取 消</el-button>
        <el-button type="primary" @click="exceptionEdit">确 定</el-button>
      </el-form>
    </el-dialog>
    <!--添加/修改问题的，固定多个填写内容地方使用-->
    <el-dialog
        :title="titleUse"
        :visible.sync="dialogVisibleAddP"
        width="40%"
        :before-close="handleClose">
      <el-form ref="tableDataForm" :model="problemDataForm" label-width="120px">
        <el-form-item label="车间名称：" prop="workshop">
          <el-input disabled v-model="problemDataForm.workshop" style="width:90%"></el-input>
        </el-form-item>
        <el-form-item label="线体名称：">
          <el-input disabled v-model="problemDataForm.lineName" style="width: 90%"></el-input>
        </el-form-item>
        <el-form-item label="工 序 号：" prop="op">
          <el-input disabled v-model="problemDataForm.op" style="width: 90%"></el-input>
        </el-form-item>
        <el-form-item label="责任人：" prop="liability">
          <el-input placeholder="请输入责任人姓名" style="width: 90%" v-model="problemDataForm.liability"></el-input>
        </el-form-item>
        <el-form-item label="工   号：" prop="liabilityNub">
          <el-input placeholder="请输入责任人工号" style="width: 90%" v-model="problemDataForm.liabilityNub"></el-input>
        </el-form-item>
        <el-form-item label="发生数量：" prop="quantity">
          <div class="block">
            <el-input-number style="width: 90%" v-model="problemDataForm.quantity" :min="1" :max="10000"></el-input-number>
          </div>
        </el-form-item>
        <el-form-item label="问题名称：" prop="problemName">
          <el-input style="width: 90%" placeholder="请输入问题名称"
                     v-model="problemDataForm.problemName"></el-input>
        </el-form-item>
        <el-form-item label="问题描述：" prop="describeUse">
          <el-input placeholder="请输入问题描述" v-model="problemDataForm.describeUse"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button @click="dialogVisibleAddP=false">取消</el-button>
          <el-button type="primary" @click="problemDataAdd">提交</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!--单击问题编辑区的弹窗，一个长的文本框-->
    <el-dialog
        :title="editProblemItem"
        :visible.sync="editProblemOneTextBigDialog"
        width="620"
        :before-close="handleClose">
      <div>
        <el-input v-model="editProblemText" style="width: 600px"></el-input>
      </div>
      <div style="margin-top: 15px">
        <el-button style="margin-right: 15px" @click="editProblemOneTextBigDialog=false">取消</el-button>
        <el-button @click="editProblemOk">提交</el-button>
      </div>
    </el-dialog>
    <!--单击问题编辑区的弹窗，需要富文本区域的地方使用-->
    <el-dialog
        :title="editProblemItem"
        :visible.sync="fullTextDialog"
        width="60%"
        :before-close="handleClose">
      <div ref="editorContainer" style="text-align: left"></div>
      <span slot="footer" class="dialog-footer">
    <el-button @click="fullTextDialog = false">取 消</el-button>
    <el-button type="primary" @click="editProblemOk">确 定</el-button>
  </span>
    </el-dialog>
    <!--单击问题编辑区的弹窗，需要一个输入数据的地方使用-->
    <el-dialog
        :title="editProblemItem"
        :visible.sync="nmbDialog"
        width="30%"
        :before-close="handleClose">
      <el-input-number label="请输入数量" v-model="inputNub"></el-input-number>
      <span slot="footer" class="dialog-footer">
    <el-button @click="nmbDialog = false">取 消</el-button>
    <el-button type="primary" @click="editProblemOk">确 定</el-button>
  </span>
    </el-dialog>
    <!--单击问题编辑区的弹窗，需要一个输入文本日期的地方-->
    <el-dialog
        :title="editProblemItem"
        :visible.sync="dateDialog"
        width="30%"
        :before-close="handleClose">
      <el-date-picker
          v-model="valueDate"
          type="date"
          placeholder="选择日期"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd">
      </el-date-picker>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dateDialog = false">取 消</el-button>
    <el-button type="primary" @click="editProblemOk">确 定</el-button>
  </span>
    </el-dialog>
    <!--单击问题编辑区的弹窗，需要一个输入负责人的地方-->
    <el-dialog
        :title="editProblemItem"
        :visible.sync="nameDialog"
        width="30%"
        :before-close="handleClose">
      <el-input placeholder="请输入内容" v-model="inputName" style="width: 100%"></el-input>
      <span slot="footer" class="dialog-footer">
    <el-button @click="nameDialog = false">取 消</el-button>
    <el-button type="primary" @click="editProblemOk">确 定</el-button>
  </span>
    </el-dialog>
    <!--单击问题编辑区的弹窗，选择是，否结题的区域-->
    <el-dialog
        :title="editProblemItem"
        :visible.sync="yesDialog"
        width="30%"
        :before-close="handleClose">
      <el-switch
          v-model="valueYes"
          active-text="是"
          inactive-text="否">
      </el-switch>
      <span slot="footer" class="dialog-footer">
    <el-button @click="yesDialog = false">取 消</el-button>
    <el-button type="primary" @click="editProblemOk">确 定</el-button>
  </span>
    </el-dialog>
    <!--选择已有问题管理的弹窗-->
    <el-dialog
        :title="editProblemItem"
        :visible.sync="selectProblemDialog"
        width="1000px"
        :before-close="handleClose">
      <div style="text-align: left;margin-bottom: 10px;font-size: 16px">
        选择的问题名称是：<span>{{selectProblemFrom.problemName}}</span>
      </div>
      <div>
        <el-table
            :data="problemData"
            border
            highlight-current-row
            height="350"
            @current-change="problemCurrentChange"
            style="width: 100%">
          <el-table-column
              prop="problemName"
              label="问题名称"
              width="300">
          </el-table-column>
          <el-table-column
              prop="describeUse"
              label="问题描述"
              width="450"
              v-slot:default="scope">
            <span v-html="scope.row.describeUse"></span>
          </el-table-column>
          <el-table-column
              prop="liability"
              label="负责人">
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
    <el-button @click="selectProblemDialog = false">取 消</el-button>
    <el-button type="primary" @click="selectProblemOk">确 定</el-button>
  </span>
    </el-dialog>
    <!--点击弹窗，一个确认信息的按钮-->
    <el-dialog
        title="提示"
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose">
      <span>{{information}}</span>
      <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="informationOk">确 定</el-button>
  </span>
    </el-dialog>
    <!--抽屉放置区域-->
    <!--问题解决的抽屉-->
    <el-drawer
        :visible.sync="problemSolvingDrawer"
        direction="ttb"
        :before-close="handleClose"
        :with-header="false"
        size="90%"
        style="overflow: scroll">
      <div style="text-align: left;font-size: 17px;color: red;margin-top: 30px;margin-left: 25px">
        <el-link style="font-size: 18px;color: red;margin-bottom: 5px" @click="editProb(1)">结论先行:</el-link>&nbsp;
        <span>{{problemDataForm.conclusion}}</span>

      </div>
      <div style="width: 98%;overflow: clip; border: 1px solid black;margin-left: 25px;margin-right: 25px;margin-top: 10px">
        <table class="blue-border">
          <thead class="tableTh">
          <tr class="tableTr">
            <th class="tableTh" style="width: 100px">问题描述</th>
            <th class="tableTh" style="width: 500px">原因分析</th>
            <th class="tableTh" colspan="2">整改对策</th>
            <th class="tableTh" style="width: 110px">完成时间</th>
            <th class="tableTh" style="width: 100px">负责人</th>
          </tr>
          </thead>
          <tbody>
          <!-- 第一行 -->
          <tr>
            <td rowspan="6" style="text-align: left;">
              <el-link style="font-size: 18px;color: red" @click="editProb(2)">问题描述：</el-link>
              <br><br>
              <div v-html="problemDataForm.describeUse"></div>
              <br><br>
              <el-link style="font-size: 18px;color: red" @click="editProb(3)">数量/次数：</el-link>
              {{problemDataForm.quantity}}
            </td>
            <td rowspan="6" style="text-align: left;">
              <el-link style="font-size: 18px;color: red" @click="editProb(4)">现状调查：</el-link><br>
              <div v-html="problemDataForm.statusUse"></div>
              <el-link style="font-size: 18px;color: red" @click="editProb(5)">发生源(产生问题的作用源）：</el-link><br>
              <div v-html="problemDataForm.origin"></div>
              <el-link style="font-size: 18px;color: red" @click="editProb(6)">流出源（含预测、预防）：</el-link><br>
              <div v-html="problemDataForm.outflow"></div>
            </td>
            <td style="width: 50px">
              <el-link @click="editProb(7)">纠正/遏制</el-link>
            </td>
            <td style="width: 450px">
              <div v-html="problemDataForm.correct" style="text-align: left"></div>
            </td>
            <td style="text-align: right">
              <span v-html="problemDataForm.correctDate"></span>&nbsp;
              <el-link>
                <i class="el-icon-edit" @click="editProb(8)"></i>
              </el-link>
            </td>
            <td style="text-align: right">
              <span v-html="problemDataForm.correctLiability"></span>&nbsp;
              <el-link>
                <i class="el-icon-edit" @click="editProb(9)"></i>
              </el-link>
            </td>
          </tr>
          <!-- 第二行 -->
          <tr>
            <td rowspan="4">纠正措施</td>
            <td rowspan="2" style="text-align: left;">
              <el-link style="font-size: 18px;color: red" @click="editProb(10)">临时措施：</el-link>
              <div v-html="problemDataForm.temporaryUse" style="text-align: left"></div>
            </td>
            <td rowspan="2" style="text-align: right">
              <span v-html="problemDataForm.temporaryDate"></span>&nbsp;
              <el-link @click="editProb(11)">
                <i class="el-icon-edit"></i>
              </el-link>
            </td>
            <td rowspan="2" style="text-align: right">
              <span v-html="problemDataForm.temporaryLiability"></span>&nbsp;
              <el-link @click="editProb(12)">
                <i class="el-icon-edit"></i>
              </el-link>
            </td>
          </tr>
          <!-- 第三行 -->
          <tr>
          </tr>
          <!-- 第四行 -->
          <tr>
            <td rowspan="2" style="text-align: left;">
              <el-link style="font-size: 18px;color: red" @click="editProb(13)">长远措施：</el-link>
              <div v-html="problemDataForm.permanent" style="text-align: left"></div>
            </td>
            <td rowspan="2" style="text-align: right">
              <span v-html="problemDataForm.permanentDate"></span>&nbsp;
              <el-link @click="editProb(14)">
                <i class="el-icon-edit"></i>
              </el-link>
            </td>
            <td rowspan="2" style="text-align: right">
              <span v-html="problemDataForm.permanentLiability"></span>&nbsp;
              <el-link @click="editProb(15)">
                <i class="el-icon-edit"></i>
              </el-link>
            </td>
          </tr>
          <!-- 第五行 -->
          <tr>
          </tr>
          <!-- 第六行 -->
          <tr>
            <td>
              <el-link @click="editProb(16)">不足反省</el-link>
            </td>
            <!-- 重复添加数据单元格，直到有7个 -->
            <td style="text-align: left;">
              <div v-html="problemDataForm.introspection"></div>
            </td>
            <td style="text-align: right">
              <span v-html="problemDataForm.introspectionDate"></span>&nbsp;
              <el-link @click="editProb(17)">
                <i class="el-icon-edit"></i>
              </el-link>
            </td>
            <td style="text-align: right">
              <span v-html="problemDataForm.introspectionLiability"></span>&nbsp;
              <el-link @click="editProb(18)">
                <i class="el-icon-edit"></i>
              </el-link>
            </td>
          </tr>
          <!-- 第七行 -->
          <tr>
            <td>
              <el-link
                  style="color: red;font-weight: bold;font-size: 16px"
                  @click="editProb(21)"
                  v-if="usePower===1">汇报：{{problemDataForm.report}}</el-link>
            </td>
            <td style="text-align: left;">
              <span>发生日期：{{problemDataForm.occurDate}}</span>
              <span style="margin-left: 20px">记录日期：{{problemDataForm.establishTime}}</span>
            </td>
            <td>
              <el-link>
                切换信息
              </el-link>
            </td>
            <td style="text-align:left">
              <el-link style="font-weight: bold;font-size: 16px" @click="editProb(19)">切换时间：{{problemDataForm.switchDate}}</el-link>
              <el-link style="font-weight: bold;font-size: 16px;margin-left: 15px" @click="editProb(20)" >切换号：{{problemDataForm.switchNumber}}</el-link>
            </td>
            <td style="text-align: center">
              <el-link style="font-weight: bold;font-size: 16px" @click="editProb(22)">结题状态</el-link>
            </td>
            <td style="text-align: right">
              <div>
                {{problemDataForm.finish}}
              </div>
            </td>
          </tr>
          <!-- 第八行 -->
          </tbody>
        </table>
      </div>
    </el-drawer>
  </div>
</template>

<script>
import E from 'wangeditor';
import {machiningAssemblyNew, opList, optionWorkshopNew, workshopAssembly,} from "@/configUse";
import _, {toInteger} from "lodash";

export default {
  name: "suspectProductNew",
  components: {},
  data() {
    return {
      activeName:'exception',
      //用户权限相关的变量
      useName:'',//用户名称
      useId:'',//用户编号
      usePower:'',//用户权限
      languageS:'chinese',//记录语言选择
      buttonDoe:1,//用户选择的是那个按钮
      buttonBackColor1:'blue',//按钮的背景颜色
      buttonColor1:'white',//按钮的字体颜色
      buttonBackColor2:'',//按钮的背景颜色
      buttonColor2:'',//按钮的字体颜色
      buttonBackColor3:'',//按钮的背景颜色
      buttonColor3:'',//按钮的字体颜色
      buttonBackColor4:'',//按钮的背景颜色
      buttonColor4:'',//按钮的字体颜色
      optionWorkshopNew:optionWorkshopNew,//记录车间名称的选择器
      lineName:[],//记录线体名称的选择器
      op:opList,//记录工序号的选择器
      //记录的是报警问题的列表
      exceptionData:[
        {
          id:null,//主键
          establishTime:'11',//创建时间
          updateTime:'11',//修改时间
          deleteSign:'11',//删除标记
          editName:'',//编辑人
          workShop:'',//车间名称，三种语言
          op:'',//工序号
          lineName:'',//线体名称
          excMessage:'',//报警信息
          excDate:'',//报警时间
          excPersonName:'',//报警反馈人
          excType:'',//报警类别  1：设备自动采集；2：人员上报；
          isNoGoodEnd:0,//判断是否产生不良的分支完成情况；0完成；1未完成；
          isProblem:-1,//-1代表，没有关联，0代表问题没有关闭；1代表问题关闭；2代表不需要纳入问题；
          downTimeOp:0,//停机时间
          downTimeLine:0,//停线时间
        }
      ],//记录的事报警、异常解除的大表数据
      exceptionDataScope:null,//记录的是用户点击的哪一行报警、故障行
      exceptionForm:{
        id:null,//主键
        establishTime:'',//创建时间
        updateTime:'',//修改时间
        deleteSign:'',//删除标记
        editName:'',//编辑人

        workShop:'',//车间名称，三种语言
        lineName:'',//线体名称
        op:'',//工序号
        excMessage:'',//报警信息
        excDate:'',//报警时间
        excPersonName:'',//报警反馈人
        excType:'',//报警类别
        isProblem:-1,//-1代表，没有完结，0代表问题没有关闭；1代表问题关闭
        downTimeOp:0,//停机时间
        downTimeLine:0,//停线时间
      },//用户编辑某一行用到的数据
      exceptionDoe:null,//用户要对报警问题的进行什么操作：1.新增；2.编辑；3.删除；
      //问题列表
      problemData:[],
      //问题解决页的列表数据problemDataForm
      problemDataForm: {
        id:null,//主键
        establishTime:'11',//创建时间
        updateTime:'11',//修改时间
        deleteSign:'11',//删除标记
        editName:'',//编辑人
        workshop: '',// 车间名称
        lineName:'',//线体名称
        drawing: '', //产品图号,含产品名称
        op: '',//工序号
        occurDate: '',//发生日期
        noteTaker: '',//记录人
        liability: '',//责任人
        liabilityNub: '',//责任人工号
        problemName: '',//问题名称
        describeUse: '',//问题描述
        describeAnnex:'',//问题描述的图片附件
        quantity: 1,//问题数量
        introspection: '',//反思

        statusUse: '',//现状调查

        //发生源
        origin: '',
        //流出源
        outflow: '',
        //临时措施
        temporaryUse: '',
        //长远措施
        permanent: '',
        //纠正
        correct: '',
        //切换发动机/零部件号日期
        switchDate: '',
        //切换发动机号/零部件号
        switchNumber: '',
        //“纠正”的完成时间
        correctDate: '',
        //"纠正的"负责人
        correctLiability: '',
        //“临时措施”的完成时间
        temporaryDate: '',
        //"临时措施"的负责人
        temporaryLiability: '',
        //“长远措施”的完成时间
        permanentDate: '',
        //"长远措施"的负责人
        permanentLiability: '',
        //“不足反省”的完成时间
        introspectionDate: '',
        //"不足反省"的负责人
        introspectionLiability: '',
        //结论先行
        conclusion: '',
        //结题状态标签
        finish: '否',
        //记录是否需要汇报
        report: '',
        //大的分类的
        type1: '',
        //小分类
        type2: '',
        //关联板块名:"机"
        machinePlateName:'',
        //关联板块id；“机”
        machinePlateId:'',
        //关联板块名:"人"
        peoplePlateName:'',
        //关联板块id；“人”
        peoplePlateId:'',
        //关联板块名："料“
        materialPlateName:'',
        //关联板id：’料‘
        materialPlateId:'',
        //关联板块名：’法‘
        methodPlateName:'',
        //关联板块id；“法”
        methodPlateId:'',
        //关联板块名：’环‘
        environmentPlateName:'',
        //关联板块id；“环”
        environmentPlateId:'',
        //关联板块名：’测‘
        measurePlateName:'',
        //关联板块id；“测”
        measurePlateId:'',
      },//问题解决页的表单函数
      //编辑问题的状态记录
      problemDataDoe:'',
      //点击问题的Scope格式
      problemDataScope:null,

      //前后五件确认的数据表单
      fiveTestDataForm:{
        id:null,//主键id
        establishTime:'11',//创建时间
        updateTime:'11',//修改时间
        deleteSign:'11',//删除标记
        editName:'',//编辑人

        //需求确认部门：
        department:'',
        //确认指导书编号
        workBookId:'',
        //确认工件号
        partId:'',
        //确认结果
        testResult:'',
        //确认描述
        testInformation:'',
        //5件确认人
        testName:'',
        //管理者审核
        examineName:'',
        //确认完成时间
        endDate:'',
        //管理者审核完成时间
        examineDate:'',
        //关联板块名:"机"：1.“机：代表是来自设备报警/异常模块的”
        machinePlateName:'',
        //关联板块id；“机”
        machinePlateId:'',
        //关联板块名:"人"
        peoplePlateName:'',
        //关联板块id；“人”
        peoplePlateId:'',
        //关联板块名："料“
        materialPlateName:'',
        //关联板id：’料‘
        materialPlateId:'',
        //关联板块名：’法‘
        methodPlateName:'',
        //关联板块id；“法”
        methodPlateId:'',
        //关联板块名：’环‘
        environmentPlateName:'',
        //关联板块id；“环”
        environmentPlateId:'',
        //关联板块名：’测‘
        measurePlateName:'',
        //关联板块id；“测”
        measurePlateId:'',
      },

      titleUse:'提示',//弹窗上的提示
      exceptionDialog:false,//编辑报警、异常解除控制的弹窗
      dialogVisibleAddP:false,//关联报警、异常与问题解决的弹窗：是要新增一个问题
      editProblemOneTextBigDialog:false,//编辑问题的一个文本框，是一个大的。
      fullTextDialog:false,//编辑问题的一个文本框，是富文本
      nmbDialog:false,//编辑问题输入一个数值的控制弹窗
      dateDialog:false,//编辑问题输入一个日期格式，是字符串YYYY-MM-dd
      nameDialog:false,//编辑问题输入一个短的文本
      yesDialog:false,//编辑问题，一个选择是和否的弹窗
      dialogVisible:false,//通用，一个确定是否要删除数据的页面
      isProblemVisible:false,//一个测试弹窗
      selectProblemDialog:false,//选择关联问题的弹窗
      problemSolvingDrawer:false,//显示问题的抽屉
      occurTime:'',//发生时间
      isProblemContactDoe:0,//记录是对问题关联的类型：1.新增问题；2.关联已有问题；3.问题挂起
      editProblemItem:'',//编辑问题时，显示项目的名称
      editProblemText:'',//编辑问题时，关联的用户输入内容；
      inputNub:0,//编辑问题时，显示的一个数值
      inputName:'',//编辑问题时，输入一个短文本，用在了负责人姓名上；
      valueDate:'',//编辑问题时，显示的一个日期文本
      valueYes:false,//放置选择是、否的按钮中
      information:'提示',//弹窗上显示信息的
      selectProblemFrom:{
        id:null,//主键
        establishTime:'',//创建时间
        updateTime:'',//修改时间
        deleteSign:'',//删除标记
        editName:'',//编辑人
        workshop: '',// 车间名称
        lineName:'',//线体名称
        drawing: '', //产品图号,含产品名称
        op: '',//工序号
        occurDate: '',//发生日期
        noteTaker: '',//记录人
        liability: '',//责任人
        liabilityNub: '',//责任人工号
        problemName: '',//问题名称
        describeUse: '',//问题描述
        describeAnnex:'',//问题描述的图片附件
        quantity:null,//问题数量
        introspection: '',//反思
        statusUse: '',//现状调查
        //发生源
        origin: '',
        //流出源
        outflow: '',
        //临时措施
        temporaryUse: '',
        //长远措施
        permanent: '',
        //纠正
        correct: '',
        //切换发动机/零部件号日期
        switchDate: '',
        //切换发动机号/零部件号
        switchNumber: '',
        //“纠正”的完成时间
        correctDate: '',
        //"纠正的"负责人
        correctLiability: '',
        //“临时措施”的完成时间
        temporaryDate: '',
        //"临时措施"的负责人
        temporaryLiability: '',
        //“长远措施”的完成时间
        permanentDate: '',
        //"长远措施"的负责人
        permanentLiability: '',
        //“不足反省”的完成时间
        introspectionDate: '',
        //"不足反省"的负责人
        introspectionLiability: '',
        //结论先行
        conclusion: '',
        //结题状态标签
        finish: '否',
        //记录是否需要汇报
        report: '',
        //大的分类的
        type1: '',
        //小分类
        type2: '',
        //关联板块名:"机"
        machinePlateName:'',
        //关联板块id；“机”
        machinePlateId:'',
        //关联板块名:"人"
        peoplePlateName:'',
        //关联板块id；“人”
        peoplePlateId:'',
        //关联板块名："料“
        materialPlateName:'',
        //关联板id：’料‘
        materialPlateId:'',
        //关联板块名：’法‘
        methodPlateName:'',
        //关联板块id；“法”
        methodPlateId:'',
        //关联板块名：’环‘
        environmentPlateName:'',
        //关联板块id；“环”
        environmentPlateId:'',
        //关联板块名：’测‘
        measurePlateName:'',
        //关联板块id；“测”
        measurePlateId:'',
      },//选择问题形成的行表单
    }
  },
  watch: {
    value1(newData){
      console.log(newData)
    },
    'exceptionForm.workShop'(newData){
      console.log(newData)
      if (newData==='装配车间/Assembly workshop/Цех сборки двигателей'){
        this.lineName=workshopAssembly
      }
      else if (newData==='机加车间/Machining workshop/Цех механической обработки'){
        this.lineName=machiningAssemblyNew
      }
    }
  },
  methods: {
    //退出登录
    logOut(){
      localStorage.removeItem('u_token');
      localStorage.removeItem('userName')
      this.$router.push('UserLogin')
    },
    //通用，语言选择
    chooseLanguage(language){
      this.languageS=language
    },
    //查询用户信息的函数
    inquiry(){
      //输入用户编号，向后端查询信息
      const useId=localStorage.getItem('userName').replace(/"/g, '');
      this.$request.post('/useQueryPower',{
        queryFiledName:'changeModel',
        userId:useId,
      }).then(result=>{
        if (result.code === 401) {
          this.$router.push('UserLogin')
          alert("您未登录，请登录")
        }else {
          this.useName=result.data.name
          this.usePower=result.data.changeModel
          this.useId=useId
        }
      })
    },
    // 通用，弹窗关闭的时候
    //无意关闭弹窗的函数
    handleClose(done) {
      this.$confirm('确认关闭？')
          // eslint-disable-next-line no-unused-vars
          .then(_ => {
            done();
          })
          // eslint-disable-next-line no-unused-vars
          .catch(_ => {});
    },
    //在tab控件上单击的函数
    handleClick(tab, event) {
      console.log(tab, event);
      if (this.activeName==='exception'){
        this.$nextTick(() => {
          // 如果需要对数据进行深拷贝来触发更新，可以考虑如下方式
          this.exceptionData = _.cloneDeep(this.exceptionData);
        })
      }
    },
    //选择主导航上的不同按钮
    buttonMainSelect(doe){
      this.buttonDoe=doe
      if (doe===1){
          this.buttonBackColor1='blue'//按钮的背景颜色
          this.buttonColor1='white'//按钮的字体颜色
          this.buttonBackColor2=''//按钮的背景颜色
          this.buttonColor2=''//按钮的字体颜色
          this.buttonBackColor3=''//按钮的背景颜色
          this.buttonColor3=''//按钮的字体颜色
          this.buttonBackColor4=''//按钮的背景颜色
          this.buttonColor4=''//按钮的字体颜色
      }
      if (doe===2){
        this.buttonBackColor1=''//按钮的背景颜色
            this.buttonColor1=''//按钮的字体颜色
        this.buttonBackColor2='blue'//按钮的背景颜色
        this.buttonColor2='white'//按钮的字体颜色
        this.buttonBackColor3=''//按钮的背景颜色
        this.buttonColor3=''//按钮的字体颜色
        this.buttonBackColor4=''//按钮的背景颜色
        this.buttonColor4=''//按钮的字体颜色
      }
      if (doe===3){
        this.buttonBackColor1=''//按钮的背景颜色
        this.buttonColor1=''//按钮的字体颜色
        this.buttonBackColor2=''//按钮的背景颜色
        this.buttonColor2=''//按钮的字体颜色
        this.buttonBackColor3='blue'//按钮的背景颜色
        this.buttonColor3='white'//按钮的字体颜色
        this.buttonBackColor4=''//按钮的背景颜色
        this.buttonColor4=''//按钮的字体颜色
      }
      if (doe===4){
        this.buttonBackColor1=''//按钮的背景颜色
        this.buttonColor1=''//按钮的字体颜色
        this.buttonBackColor2=''//按钮的背景颜色
        this.buttonColor2=''//按钮的字体颜色
        this.buttonBackColor3=''//按钮的背景颜色
        this.buttonColor3=''//按钮的字体颜色
        this.buttonBackColor4='blue'//按钮的背景颜色
        this.buttonColor4='white'//按钮的字体颜色
      }
    },
    //电脑端增加一条报警/异常记录的显示函数 1：新增；2：编辑；3：删除；
    editException(doe,copse){
      this.exceptionDataScope=copse
      this.exceptionDoe=doe
      if (doe===1){
        this.exceptionForm={
          id:null,//主键
          establishTime:'',//创建时间
          updateTime:'',//修改时间
          deleteSign:1,//删除标记
          editName:this.useName+'/'+this.useId,//编辑人

          workShop:'',//车间名称，三种语言
          lineName:'',//线体名称
          op:'',//工序号
          excMessage:'',//报警信息
          excDate:'',//报警时间
          excPersonName:this.useName,//报警反馈人
          excType:0,//报警类别
          isProblem: -1,
          downTimeOp: 0,
          downTimeLine:0,
        }
        this.titleUse='新增一项异常/报警信息'
        this.exceptionDialog=true
      }
    },
    //编辑、新增报警、异常信息，点击确定提交按钮
    exceptionEdit(){
      //判断数据
      if (this.exceptionForm.workShop===null || this.exceptionForm.workShop===undefined || this.exceptionForm.workShop===''){
        this.$message.error('请选择车间名称')
        return
      }
      else if (this.exceptionForm.lineName===null || this.exceptionForm.lineName===undefined || this.exceptionForm.lineName===''){
        this.$message.error('请选择线体名称')
        return;
      }
      else if (this.exceptionForm.op=== null || this.exceptionForm.op===undefined || this.exceptionForm.op===''){
        this.$message.error('请选择工序号')
        return;
      }
      else if (this.exceptionForm.excDate===null || this.exceptionForm.excDate===undefined || this.exceptionForm.excDate===''){
        this.$message.error('请选择发生日期')
        return;
      }
      else if (this.occurTime===null || this.occurTime===undefined || this.occurTime===''){
        this.$message.error('请选择发生时间')
        return;
      }
      else if (this.exceptionForm.excPersonName===null || this.exceptionForm.excPersonName===undefined || this.exceptionForm.excPersonName===''){
        this.$message.error('请输入反馈人')
        return;
      }
      //组合数据
      this.exceptionForm.editName=this.useName+'/'+this.useId
      this.exceptionForm.excDate=this.exceptionForm.excDate+' '+this.occurTime
      //向后端发送信息，是新增
      if (this.exceptionDoe===1){
        //组合数据，把报警时间更改为date格式
        this.exceptionForm.excDate.replace(' ', 'T');
        this.exceptionForm.excDate=new Date(this.exceptionForm.excDate)
        this.$request.post('excInsertWorkExceptionRemoval',this.exceptionForm).then(result=>{
          if (result.code === 401) {
            this.$router.push('UserLogin')
            alert("您未登录，请登录")
          } else {
            if (result.data==='' || result.data===null || result.data===undefined){
              this.$message.error('信息错误，请联系管理员')

            }
            else {
              this.exceptionData=result.data
              this.exceptionDialog=false
            }
          }
        })
      }
    },
    //点击问题查看，显示问题解决情况,弹出抽屉
    problemShow(scope){
      //数据赋值
      this.problemDataScope=scope
      this.problemDataForm=scope.row
      this.problemSolvingDrawer=true

    },
    //点击问题修改，只修改问题名称
    problemEditShow(scope,doe){
      //以后再开发
      this.problemDataScope=scope
      this.problemDataDoe=doe
      this.editProblemItem='问题名称：'
      this.editProblemText=scope.row.problemName
      this.editProblemOneTextBigDialog=true
    },
    //编辑问题的函数集合,显示弹窗
    editProb(doe){
      //判断用户是否有权限，根据工号判定
      if (!this.problemDataForm.liabilityNub.toLowerCase().includes(this.useId.toLowerCase())){
        this.$message.error('您不是责任人，不能修改问题')
        return
      }
      this.problemDataDoe=doe
      //结论先行
      if (doe===1){
        //需要一个文本框的弹窗
        this.editProblemItem='结论先行：'
        this.editProblemText=this.problemDataForm.conclusion
        this.editProblemOneTextBigDialog=true
      }
      else if (doe===2){
        this.editProblemItem='问题描述：'
        this.fullTextDialog=true
        this.$nextTick(() => {
          this.initEditor();
          this.editor.txt.html(this.problemDataForm.describeUse)
        })
      }
      else if (doe===3){
        this.editProblemItem='数量/次数：'
        this.inputNub=this.problemDataForm.quantity
        this.nmbDialog=true
      }
      else if (doe===4){
        this.editProblemItem='现状调查：'
        this.fullTextDialog=true
        this.$nextTick(() => {
          this.initEditor();
          this.editor.txt.html(this.problemDataForm.statusUse)
        })
      }
      else if (doe===5){
        this.editProblemItem='发生源：'
        this.fullTextDialog=true
        this.$nextTick(() => {
          this.initEditor();
          this.editor.txt.html(this.problemDataForm.origin)
        })
      }
      else if (doe===6){
        this.editProblemItem='流出源：'
        this.fullTextDialog=true
        this.$nextTick(() => {
          this.initEditor();
          this.editor.txt.html(this.problemDataForm.outflow)
        })
      }
      else if (doe===7){
        this.editProblemItem='纠正措施：'
        this.fullTextDialog=true
        this.$nextTick(() => {
          this.initEditor();
          this.editor.txt.html(this.problemDataForm.correct)
        })
      }
      else if (doe===8){
        this.editProblemItem='纠正措施完成时间：'
          this.valueDate=this.problemDataForm.switchDate
          this.dateDialog=true
      }
      else if (doe===9){
        this.editProblemItem='纠正措施负责人：'
        this.valueDate=this.problemDataForm.correctLiability
        this.nameDialog=true
      }
      else if (doe===10){
        this.editProblemItem='临时措施：'
        this.fullTextDialog=true
        this.$nextTick(() => {
          this.initEditor();
          this.editor.txt.html(this.problemDataForm.temporaryUse)
        })
      }
      else if (doe===11){
        this.editProblemItem='临时措施完成时间：'
        this.valueDate=this.problemDataForm.temporaryDate
        this.dateDialog=true
      }
      else if (doe===12){
        this.editProblemItem='临时措施负责人：'
        this.valueDate=this.problemDataForm.temporaryLiability
        this.nameDialog=true
      }
      else if (doe===13){
        this.editProblemItem='长远措施：'
        this.fullTextDialog=true
        this.$nextTick(() => {
          this.initEditor();
          this.editor.txt.html(this.problemDataForm.permanent)
        })
      }
      else if (doe===14){
        this.editProblemItem='长远措施完成时间：'
        this.valueDate=this.problemDataForm.permanentDate
        this.dateDialog=true
      }
      else if (doe===15){
        this.editProblemItem='临时措施负责人：'
        this.valueDate=this.problemDataForm.permanentLiability
        this.nameDialog=true
      }
      else if (doe===16){
        this.editProblemItem='不足反省：'
        this.fullTextDialog=true
        this.$nextTick(() => {
          this.initEditor();
          this.editor.txt.html(this.problemDataForm.introspection)
        })
      }
      else if (doe===17){
        this.editProblemItem='不足反省完成时间：'
        this.valueDate=this.problemDataForm.introspectionDate
        this.dateDialog=true
      }
      else if (doe===18){
        this.editProblemItem='临时措施负责人：'
        this.valueDate=this.problemDataForm.introspectionLiability
        this.nameDialog=true
      }
      else if (doe===19){
        this.editProblemItem='切换时间：'
        this.valueDate=this.problemDataForm.switchDate
        this.dateDialog=true
      }
      else if (doe===20){
        this.editProblemItem='临时措施负责人：'
        this.valueDate=this.problemDataForm.switchNumber
        this.nameDialog=true
      }
      else if (doe===21){
        this.editProblemItem='是否汇报：'
        this.valueDate=this.problemDataForm.report
        this.yesDialog=true
      }
      else if (doe===22){
        this.editProblemItem='结题状态：'
        this.valueDate=this.problemDataForm.finish
        this.yesDialog=true
      }
    },
    //提交对问题库的更改
    editProblemOk(){
      //找到编辑数据的索引值
      const index = this.problemData.findIndex(item => item.id === this.problemDataForm.id);
      if (this.problemDataDoe===1){
        this.editOneFiledProblemStr('conclusion',this.editProblemText,this.problemDataForm.id)
        this.problemDataForm.conclusion=this.editProblemText
        this.problemData.splice(index,1,this.problemDataForm)
        this.editProblemOneTextBigDialog=false
      }
      else if (this.problemDataDoe===2){
        this.editOneFiledProblemStr('describeUse',this.editor.txt.html(),this.problemDataForm.id)
        this.problemDataForm.describeUse=this.editor.txt.html()
        this.problemData.splice(index,1,this.problemDataForm)
        this.fullTextDialog=false
      }
      else if (this.problemDataDoe===3){
        this.editOneFiledProblemInt('quantity',this.inputNub,this.problemDataForm.id)
        this.problemDataForm.quantity=this.inputNub
        this.problemData.splice(index,1,this.problemDataForm)
        this.nmbDialog=false
      }
      else if (this.problemDataDoe===4){
        this.editOneFiledProblemStr('statusUse',this.editor.txt.html(),this.problemDataForm.id)
        this.problemDataForm.statusUse=this.editor.txt.html()
        this.problemData.splice(index,1,this.problemDataForm)
        this.fullTextDialog=false
      }
      else if (this.problemDataDoe===5){
        this.editOneFiledProblemStr('origin',this.editor.txt.html(),this.problemDataForm.id)
        this.problemDataForm.origin=this.editor.txt.html()
        this.problemData.splice(index,1,this.problemDataForm)
        this.fullTextDialog=false
      }
      else if (this.problemDataDoe===6){
        this.editOneFiledProblemStr('outflow',this.editor.txt.html(),this.problemDataForm.id)
        this.problemDataForm.outflow=this.editor.txt.html()
        this.problemData.splice(index,1,this.problemDataForm)
        this.fullTextDialog=false
      }
      else if (this.problemDataDoe===7){
        this.editOneFiledProblemStr('correct',this.editor.txt.html(),this.problemDataForm.id)
        this.problemDataForm.correct=this.editor.txt.html()
        this.problemData.splice(index,1,this.problemDataForm)
        this.dateDialog=false
      }
      else if (this.problemDataDoe===8){
        this.editOneFiledProblemStr('correctDate',this.valueDate,this.problemDataForm.id)
        this.problemDataForm.correctDate=this.valueDate
        this.problemData.splice(index,1,this.problemDataForm)
        this.fullTextDialog=false
      }
      else if (this.problemDataDoe===9){
        this.editOneFiledProblemStr('correctLiability',this.inputName,this.problemDataForm.id)
        this.problemDataForm.correctLiability=this.inputName
        this.problemData.splice(index,1,this.problemDataForm)
        this.nameDialog=false
      }
      else if (this.problemDataDoe===10){
        this.editOneFiledProblemStr('temporaryUse',this.editor.txt.html(),this.problemDataForm.id)
        this.problemDataForm.temporaryUse=this.editor.txt.html()
        this.problemData.splice(index,1,this.problemDataForm)
        this.fullTextDialog=false
      }
      else if (this.problemDataDoe===11){
        this.editOneFiledProblemStr('temporaryDate',this.valueDate,this.problemDataForm.id)
        this.problemDataForm.temporaryDate=this.valueDate
        this.problemData.splice(index,1,this.problemDataForm)
        this.dateDialog=false
      }
      else if (this.problemDataDoe===12){
        this.editOneFiledProblemStr('temporaryLiability',this.inputName,this.problemDataForm.id)
        this.problemDataForm.temporaryLiability=this.inputName
        this.problemData.splice(index,1,this.problemDataForm)
        this.nameDialog=false
      }
      else if (this.problemDataDoe===13){
        this.editOneFiledProblemStr('permanent',this.editor.txt.html(),this.problemDataForm.id)
        this.problemDataForm.permanent=this.editor.txt.html()
        this.problemData.splice(index,1,this.problemDataForm)
        this.fullTextDialog=false
      }
      else if (this.problemDataDoe===14){
        this.editOneFiledProblemStr('permanentDate',this.valueDate,this.problemDataForm.id)
        this.problemDataForm.permanentDate=this.valueDate
        this.problemData.splice(index,1,this.problemDataForm)
        this.dateDialog=false
      }
      else if (this.problemDataDoe===15){
        this.editOneFiledProblemStr('permanentLiability',this.inputName,this.problemDataForm.id)
        this.problemDataForm.permanentLiability=this.inputName
        this.problemData.splice(index,1,this.problemDataForm)
        this.nameDialog=false
      }
      else if (this.problemDataDoe===16){
        this.editOneFiledProblemStr('introspection',this.editor.txt.html(),this.problemDataForm.id)
        this.problemDataForm.introspection=this.editor.txt.html()
        this.problemData.splice(index,1,this.problemDataForm)
        this.fullTextDialog=false
      }
      else if (this.problemDataDoe===17){
        this.editOneFiledProblemStr('introspectionDate',this.valueDate,this.problemDataForm.id)
        this.problemDataForm.introspectionDate=this.valueDate
        this.problemData.splice(index,1,this.problemDataForm)
        this.dateDialog=false
      }
      else if (this.problemDataDoe===18){
        this.editOneFiledProblemStr('introspectionLiability',this.inputName,this.problemDataForm.id)
        this.problemDataForm.introspectionLiability=this.inputName
        this.problemData.splice(index,1,this.problemDataForm)
        this.nameDialog=false
      }
      else if (this.problemDataDoe===19){
        this.editOneFiledProblemStr('switchDate',this.valueDate,this.problemDataForm.id)
        this.problemDataForm.switchDate=this.valueDate
        this.problemData.splice(index,1,this.problemDataForm)
        this.dateDialog=false
      }
      else if (this.problemDataDoe===20){
        this.editOneFiledProblemStr('switchNumber',this.inputName,this.problemDataForm.id)
        this.problemDataForm.switchNumber=this.inputName
        this.problemData.splice(index,1,this.problemDataForm)
        this.nameDialog=false
      }
      else if (this.problemDataDoe===21){
        if (this.valueYes){
          this.editOneFiledProblemStr('report','是',this.problemDataForm.id)
          this.problemDataForm.report='是'
          this.problemData.splice(index,1,this.problemDataForm)
        }
        else {
          this.editOneFiledProblemStr('report','否',this.problemDataScope.row.id)
          this.problemDataForm.report='否'
          this.problemData.splice(index,1,this.problemDataForm)
        }
        this.yesDialog=false
      }
      else if (this.problemDataDoe===22){
        if (this.valueYes){
          this.editOneFiledProblemStr('finish','是',this.problemDataForm.id)
          this.problemDataForm.finish='是'
          this.problemData.splice(index,1,this.problemDataForm)
          //修改报警信息中的问题结题状态
          let temp=this.problemDataForm.machinePlateId.split('/')
          for (let i = 0; i < temp.length; i++) {
            this.editOneFiledExceptionDataInt('isProblem',1,toInteger(temp[i]))
            const index1 = this.exceptionData.findIndex(item => item.id ===toInteger(temp[i]));
            //修改数据
            this.exceptionData[index1].isProblem=1
          }
        }
        else {
          this.editOneFiledProblemStr('finish','否',this.problemDataForm.id)
          this.problemDataForm.finish='否'
          this.problemData.splice(index,1,this.problemDataForm)
          //修改报警信息中的问题结题状态，去找和这一个问题关联的所有报警/问题
          let temp=this.problemDataForm.machinePlateId.split('/')
          for (let i = 0; i < temp.length; i++) {
            this.editOneFiledExceptionDataInt('isProblem',0,toInteger(temp[i]))
            const index1 = this.exceptionData.findIndex(item => item.id ===toInteger(temp[i]));
            //修改数据
            this.exceptionData[index1].isProblem=0
          }
        }
        this.yesDialog=false
      }
      else if (this.problemDataDoe===23){
        this.editOneFiledProblemStr('problemName',this.editProblemText,this.problemDataForm.id)
        this.problemDataForm.problemName=this.editProblemText
        this.problemData.splice(index,1,this.problemDataForm)
        this.editProblemOneTextBigDialog=false
      }
    },
    //辅助函数：查询所有的报警数据
    inquiryExcAll(){
      this.$request.post('inquiryExcAllWorkExceptionRemoval').then(result=>{
        if (result.code === 401) {
          this.$router.push('UserLogin')
          alert("您未登录，请登录")
        } else {
          this.exceptionData=result.data
        }
      })
    },
    //把报警、异常清单，和问题关联起来；需要弹窗，可以设置问题为：无需解决；需要解决（新增问题、关联已有问题）// 切换 显示问题关联的弹窗
    togglePopover(scope) {
      this.exceptionDataScope=scope
      this.exceptionForm=scope.row
      scope.row.isProblemVisible = !scope.row.isProblemVisible
    },
    //通用，一个提示框，点击确定后的反应
    informationOk(){
      if (this.isProblemContactDoe===2){
        //是要进行不解决设备报警的
        //修改报警/异常的问题状态，修改为2，处于问题挂起；
        this.editOneFiledExceptionDataInt('isProblem',2,this.exceptionDataScope.row.id)
        //更新数据
        this.exceptionForm.isProblem=2
        this.exceptionDataScope.row.isProblem=2
        this.exceptionData.splice(this.exceptionDataScope.$index,1,this.exceptionForm)
        this.dialogVisible=false
      }
    },
    //关联问题的函数
    isProblemContact(doe,scope){
      //新增问题，弹窗，输入新增问题的那些信息
      this.isProblemContactDoe=doe
      //是要新增关联问题
      // 关闭显示
      scope.row.isProblemVisible=false
      //新增一个问题
      if (doe===1){
        this.problemDataForm= {
              id:null,//主键
              establishTime:null,//创建时间
              updateTime:null,//修改时间
              deleteSign:1,//删除标记
              editName:this.useName,//编辑人
              workshop: this.exceptionDataScope.row.workShop,// 车间名称
              lineName:this.exceptionDataScope.row.lineName,//线体名称
              drawing: '', //产品图号,含产品名称
              op: this.exceptionDataScope.row.op,//工序号
              occurDate: '',//发生日期
              noteTaker: '',//记录人
              liability: '',//责任人
              liabilityNub: '',//责任人工号
              problemName: this.exceptionDataScope.row.excMessage,//问题名称
              describeUse: this.exceptionDataScope.row.excMessage,//问题描述
              describeAnnex:'',//问题描述的图片附件
              quantity: 1,//问题数量
              introspection: '',//反思
              statusUse: '',//现状调查
              //发生源
              origin: '',
              //流出源
              outflow: '',
              //临时措施
              temporaryUse: '',
              //长远措施
              permanent: '',
              //纠正
              correct: '',
              //切换发动机/零部件号日期
              switchDate: '',
              //切换发动机号/零部件号
              switchNumber: '',
              //“纠正”的完成时间
              correctDate: '',
              //"纠正的"负责人
              correctLiability: '',
              //“临时措施”的完成时间
              temporaryDate: '',
              //"临时措施"的负责人
              temporaryLiability: '',
              //“长远措施”的完成时间
              permanentDate: '',
              //"长远措施"的负责人
              permanentLiability: '',
              //“不足反省”的完成时间
              introspectionDate: '',
              //"不足反省"的负责人
              introspectionLiability: '',
              //结论先行
              conclusion: '',
              //结题状态标签
              finish: '否',
              //记录是否需要汇报
              report: '',
              //大的分类的
              type1: '',
              //小分类
              type2: '',
              //关联板块名:"机"
              machinePlateName:'',
              //关联板块id；“机”
              machinePlateId:'',
              //关联板块名:"人"
              peoplePlateName:'',
              //关联板块id；“人”
              peoplePlateId:'',
              //关联板块名："料“
              materialPlateName:'',
              //关联板id：’料‘
              materialPlateId:'',
              //关联板块名：’法‘
              methodPlateName:'',
              //关联板块id；“法”
              methodPlateId:'',
              //关联板块名：’环‘
              environmentPlateName:'',
              //关联板块id；“环”
              environmentPlateId:'',
              //关联板块名：’测‘
              measurePlateName:'',
              //关联板块id；“测”
              measurePlateId:'',
        }
        // 组合数据,关联板块，因为是新增，并且报警解除是放在了第一个位置，所以就是没有分割符
        this.problemDataForm.machinePlateName='机'
        //关联id，因为是新建，因此是第一个，不需要增加分割符
        this.problemDataForm.machinePlateId=this.exceptionDataScope.row.id
        //组合发生日期
        this.problemDataForm.occurDate=this.exceptionDataScope.row.excDate
        //打开问题弹窗
        this.dialogVisibleAddP=true
      }
      //是要挂起问题，修改问题关联状态
      else if (doe===2){
        //弹出一个确定的窗口
        this.information='确定问题不需要解决吗？'
        this.dialogVisible=true
        this.exceptionDataScope=scope
        this.exceptionForm=scope.row
      }
      //是要关联已有问题
      else if (doe===3){
        this.exceptionDataScope=scope
        this.exceptionForm=scope.row
        //打开一个弹窗，选择问题列表
        this.editProblemItem='您正在关联已有问题：'
        this.selectProblemDialog=true
      }
    },
    //根据报警/异常，对问题进行添加
    problemDataAdd(){
      //是新增一个质量问题，质量问题与板块关联，设置了6列，分别是“人、机、料、法、环、测”，报警/异常解除是“机”的，“可疑品”是料的。
      //是新增一个问题
      if (this.isProblemContactDoe===1){
        //
        //向后端发送数据，在问题库中，插入一条数据
        this.$request.post('/problemInsertOneWorkExceptionRemoval',this.problemDataForm).then(result=>{
          if (result.code === 401) {
            this.$router.push('UserLogin')
            alert("您未登录，请登录")
          } else {
              //修改数据库中的报警/异常中的是否结题这个字段，需要修改为未结题：0
              this.editOneFiledExceptionDataInt('isProblem',0,this.exceptionForm.id)
              //数据赋值，向后端筛选是“机”的所有问题，
              this.exceptionForm.isProblem=0
              this.exceptionDataScope.row.id=0
              this.exceptionData.splice(this.exceptionDataScope.$index,this.exceptionForm.id)
              this.dialogVisibleAddP=false
          }
        })
      }
    },
    //在设备页，点击要查看问题进展
    excProblemShow(scope){
      //循环去找问题库关联的问题
      for (let i = 0; i < this.problemData.length; i++) {
        let isOk=0
        //分割出关联的数字
        let temp=this.problemData[i].machinePlateId.split('/')
        for (let j = 0; j < temp.length; j++) {
          if (toInteger(temp[j]) ===toInteger(scope.row.id) ){
            this.problemDataForm=this.problemData[i]
            isOk=1
            this.problemSolvingDrawer=true
            break
          }
        }
        if (isOk===1){
          break
        }
      }
    },
    //点击关联已有问题，确定后的函数
    selectProblemOk(){
      const index = this.problemData.findIndex(item => item.id === this.selectProblemFrom.id);
      //修改问题数据库中的信息现在这个问题有了，说明里面可能有已经链接好的ID号。
      if (this.selectProblemFrom.machinePlateId==='' || this.selectProblemFrom.machinePlateId===null || this.selectProblemFrom.machinePlateId===undefined){
        //是空的
        const temp=this.exceptionDataScope.row.id
        //向后端写入数据
         this.editOneFiledProblemStr('machinePlateId',temp,this.selectProblemFrom.id)
        //修改主表数据值
        this.problemData[index].machinePlateId=temp
        this.problemDataForm.machinePlateId=temp
        this.problemDataScope.row.machinePlateId=temp
      }
      else {
        const temp=this.selectProblemFrom.machinePlateId+'/'+this.exceptionDataScope.row.id
        //向后端写入数据
        this.editOneFiledProblemStr('machinePlateId',temp,this.selectProblemFrom.id)
        //修改主表数据值
        this.problemData[index].machinePlateId=temp
        this.problemDataForm.machinePlateId=temp
      }
      if (this.selectProblemFrom.machinePlateName==='' || this.selectProblemFrom.machinePlateName===null || this.selectProblemFrom.machinePlateName===undefined){
        const temp='机'
         this.editOneFiledProblemStr('machinePlateId',temp,this.selectProblemFrom.id)
        //修改主表数据值
        this.problemData[index].machinePlateName=temp
        this.problemDataForm.machinePlateName=temp
      }


      //修改报警/异常表中的关联，需要把问题状态按照问题是否完成修改
      if (this.selectProblemFrom.finish==='是'){
         this.editOneFiledExceptionDataInt('isProblem',1,this.exceptionForm.id)
        //修改已有数据
        this.exceptionDataScope.row.isProblem=1
        this.exceptionForm.isProblem=1
        this.exceptionData.splice(this.exceptionDataScope.$index,1,this.exceptionForm)
      }
      else if (this.selectProblemFrom.finish==='否'){
         this.editOneFiledExceptionDataInt('isProblem',0,this.exceptionForm.id)
        //修改已有数据
        this.exceptionDataScope.row.isProblem=0
        this.exceptionForm.isProblem=0
        this.exceptionData.splice(this.exceptionDataScope.$index,1,this.exceptionForm)
      }

      this.selectProblemDialog=false
    },
    //辅助函数：报警/异常与已有问题关联，在弹窗中单击问题列表，做出反应的函数
    problemCurrentChange(val){
      this.selectProblemFrom=val
    },
    //辅助函数：对问题库进行查询操作，最多可以十个字段，都是相等。六个字段是字符串，两个字段是数字型， 以及两个字段，是选取区间的
    inquiryProblem(firstFiledName,firstFiledVal,secondFiledName,secondFiledVal){
      this.$request.post('/inquiryProblemOneFiledWorkExceptionRemoval',{
        firstFiledName:firstFiledName,
        firstFiledVal:firstFiledVal,
        secondFiledName:secondFiledName,
        secondFiledVal:secondFiledVal,
      })
          .then(result=>{
            if (result.code === 401) {
              this.$router.push('UserLogin')
              alert("您未登录，请登录")
            } else {
              this.problemData=result.data
              console.log(result.data)
            }
          })

    },
    //辅助函数：对报警/异常问题库的一个行的某一个字段进行修改,修改的值是数字，修改后，只反馈一个保存成功；大表赋值，在主函数中完成
    editOneFiledExceptionDataInt(firstFiledName,firstFiledVal,id){
      this.$request.post('/editOneFiledExceptionDataIntRemoval',{
        id:id,
        firstFiledName:firstFiledName,
        firstFiledVal:firstFiledVal,
      }).then(result=>{
        if (result.code === 401) {
          this.$router.push('UserLogin')
          alert("您未登录，请登录")
        } else {
          this.$message.success('关联成功')
        }
      })
    },
    //辅助函数：对问题库，修改一个字段，是字符串
    editOneFiledProblemStr(filedName,filedVal,id){
      //向后端发送请求
      this.$request.post('/editOneFiledStrProblemWorkException',{
        filedName:filedName,
        filedVal:filedVal,
        id:id,
      }).then(result=>{
        if (result.code === 401) {
          this.$router.push('UserLogin')
          alert("您未登录，请登录")
        } else {
          this.$message.success('修改成功')
        }
      })
    },
    //辅助函数：对问题库，修改一个字段，是数字
    editOneFiledProblemInt(filedName,filedVal,id){
      //向后端发送请求
      this.$request.post('/editOneFiledIntProblemWorkException',{
        filedName:filedName,
        filedVal:filedVal,
        id:id,
      }).then(result=>{
        if (result.code === 401) {
          this.$router.push('UserLogin')
          alert("您未登录，请登录")
        } else {
          this.$message.success('修改成功')
        }
      })
    },
    //辅助函数：  初始化 wangEditor
    initEditor() {
      // 检查是否已经存在编辑器实例
      if (this.editor) {
        return; // 如果已经存在，则直接返回，不重复初始化
      }
      this.editor = new E(this.$refs.editorContainer);
      this.editor.config.menus = [
        'head',
        'bold',
        'italic',
        'underline',
        'strikeThrough',
        'foreColor',
        'backColor',
        'list',
        'justify',
        'table',
        // 其他你需要的菜单...
      ]
      this.editor.create();
    },
  },

  mounted() {
    this.inquiry()
    this.exceptionData=[]
    this.inquiryExcAll()
    for (let i = 0; i < this.exceptionData.length; i++) {
      this.exceptionData[i].isProblemVisible=false
    }

    this.inquiryProblem('machinePlateName','机')
  },
  //组件销毁前的函数
  beforeDestroy() {
    // 组件销毁前，销毁 wangEditor 实例
    if (this.editor) {
      this.editor.destroy();
      this.editor = null;
    }
  },

}
</script>

<style scoped>
/* 主体左侧的工作步骤栏用到的数据包围的div的样式*/

.el-footer {
  background-color: #ffffff;
  color: #333;
  text-align: center;
  border-width: 3px; /* 设置边框宽度为3像素 */
  border-color: blue; /* 设置边框颜色为蓝色 */
  border-style: solid; /* 设置边框样式为实线 */
  padding: 10px; /* 添加内边距 */
  border-left-color: white;
  border-top: white;
}

.el-aside {
  background-color: #ffffff;
  color: #333;
  text-align: center;
  border-width: 3px; /* 设置边框宽度为3像素 */
  border-color: blue; /* 设置边框颜色为蓝色 */
  border-style: solid; /* 设置边框样式为实线 */
  padding: 10px; /* 添加内边距 */
  height: 89vh;
}

.el-main {
  color: #333;
  text-align: center;
  border-width: 3px; /* 设置边框宽度为3像素 */
  border-color: blue; /* 设置边框颜色为蓝色 */
  border-left-color: white;
  border-style: solid; /* 设置边框样式为实线 */
  padding: 10px; /* 添加内边距 */
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.headMain{
  color: #ffffff; /* 设置字体颜色为红色 */
  font-size: 18px;
}
.center-text {
  /* 使用 margin-left 和 margin-right auto 来实现居中效果 */
  margin-left: auto;
  margin-right: auto;
  /* 注意：如果 header 内只有这两个元素，你可能不需要 margin-right: auto */
}

/*自定义样式*/

.blue-border {
  border-collapse: collapse; /* 合并相邻的边框 */
  width: 100%; /* 设置表格宽度为100% */
}

.blue-border th,
.blue-border td {
  border: 1px solid blue; /* 设置边框颜色为蓝色，宽度为1px */
  padding: 8px; /* 设置单元格内边距，以使内容更清晰可见 */
}

/* 如果你只想为thead和tbody中的单元格设置边框，可以分别指定 */
.blue-border thead th,
.blue-border tbody td {
  /* 这里可以添加额外的thead或tbody特定的样式 */
}
.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both
}
.dialog-footer {
  display: flex;
  justify-content: center; /* 水平居中 */
  align-items: center; /* 垂直居中（如果按钮不是单行的话）*/
  padding: 10px; /* 你可以根据需要调整内边距 */
}
</style>